Skip to content

Conversation

@jfurfaro
Copy link
Member

Claude Code Opus 4.5: added types to all service methods, first pass

Completed Changes

Service files - Added entity types and raw DB row types:

  • customers.ts - Added Customer type, CustomerInput type
  • transactions.ts - Added Transaction, TransactionRow types
  • events.ts - Added Event, EventRow types (with numeric field conversion)
  • guests.ts - Added Guest, GuestInput, GuestQueryOptions types
  • tickets.ts - Added Ticket, CustomerTicket, CustomerAccommodation, TicketInspection types
  • orders.ts - Added Order, OrderRow, OrderWithItems, OrderRowWithItems types
  • products.ts - Added Product, ProductRow types with convertPriceToNumber
  • promos.ts - Added PromoRow type with convertPriceAndDiscountsToNumbers
  • email.ts - Added parameter types to all functions

Route files - Added isRecordLike guards:

  • guests.ts, customers.ts, products.ts, promos.ts, events.ts, orders.ts, sites.ts

Remaining TypeScript Errors (Pre-existing)

The ~170 remaining errors are not caused by these changes but rather:

  1. Missing type declarations for braintree, mailgun-js, qrcode modules
  2. unknown type in catch blocks - TypeScript strict mode requires typed error handling
  3. Router middleware types - Koa Router types don't match AppContext types
  4. Null/undefined safety - Many possibly undefined warnings on existing code

These pre-existing issues were previously masked by implicit any types. Fixing them would require:

  • Installing @types/braintree, @types/mailgun-js
  • Adding error type guards in catch blocks
  • Properly typing the Koa Router instances
  • Adding null checks where values may be undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants